#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct stuname {
    char name[30];
} name1;

void copy(char *str, struct stuname *qname);

int main(void) {
    struct stuname *qname = &name1;
    char *str = (char *)malloc(10 * sizeof(char));
    str = (char *)realloc(str, 20 * sizeof(char));
    copy(str, qname);
    printf("%s", qname->name);
    
    free(str);
    
    system("pause");
    return 0;
}

void copy(char *str, struct stuname *qname){
	strcpy(str, "Hello world");
	strcpy(qname -> name, str);
}